<?php
/**
 * Created by PhpStorm.
 * User: lir08
 * Date: 2019/11/11
 * Time: 19:41
 */

namespace business\elasticsearch\types;

class MaterialMapConfigType
{
    /**
     * 基础设置
     * @return array
     */
    public static function settingsConfig()
    {
        return [
            'index' => [
                'number_of_shards' => 5,
                'number_of_replicas' => 1,
                'analysis.analyzer.default.type' => 'ik_max_word',
            ]
        ];
    }

    /**
     * mapping配置
     * @return array
     */
    public static function mapConfig()
    {
        return [
            'properties' => [
                // 材料id
                'uid'             => [
                    'type'        => 'text',
                    'fields'      => [
                        'keyword' => [
                            'ignore_above' => 256,
                            'type'         => 'keyword'
                        ]
                    ]
                ]
                ,
                // 城市code
                'areaCode'        => [
                    'type'        => 'text',
                    'fields'      => [
                        'keyword' => [
                            'ignore_above' => 256,
                            'type'         => 'keyword'
                        ]
                    ]
                ]
                ,
                // 城市名称
                'areaName'        => [
                    'type'        => 'text',
                    'fields'      => [
                        'keyword' => [
                            'ignore_above' => 256,
                            'type'         => 'keyword'
                        ]
                    ]
                ]
                ,
                // 材料名称
                'materialName'    => [
                    'type'        => 'text',
                    'fields'      => [
                        'keyword' => [
                            'ignore_above' => 256,
                            'type'         => 'keyword'
                        ]
                    ]
                ]
                ,
                // 材料规格
                'materialSpecs'   => [
                    'type'        => 'text',
                    'fields'      => [
                        'keyword' => [
                            'ignore_above' => 256,
                            'type'         => 'keyword'
                        ]
                    ]
                ]
                ,
                // 材料分类code
                'materialCategoryCode'     => [
                    'type'                 => 'text',
                    'fields'               => [
                        'keyword'          => [
                            'ignore_above' => 256,
                            'type'         => 'keyword'
                        ]
                    ]
                ]
                ,
                // 材料分类
                'materialCategory'         => [
                    'type'                 => 'text',
                    'fields'               => [
                        'keyword'          => [
                            'ignore_above' => 256,
                            'type'         => 'keyword'
                        ]
                    ]
                ]
                ,
                // 材料分类别名
                'materialCategoryAlias'    => [
                    'type'                 => 'text',
                    'fields'               => [
                        'keyword'          => [
                            'ignore_above' => 256,
                            'type'         => 'keyword'
                        ]
                    ]
                ]
                ,
                // 材料code
                'materialSkuCodes'         => [
                    'type'                 => 'text',
                    'fields'               => [
                        'keyword'          => [
                            'ignore_above' => 256,
                            'type'         => 'keyword'
                        ]
                    ]
                ]
            ]
        ];
    }
}
